package com.homework.work02;

import java.util.Scanner;

public class Work02_07 {
    public static void main(String[] args) {
        int number = (int)(Math.random()*100);
        int index = 0;
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入0-99的整数：");
        for (int i = 0; i < 20; i++) {
            int n = scanner.nextInt();
            if (i==0 && n==number){
                System.out.println("你太有才了！");
                index = i+1;
                break;
            }else if (n>number){
                System.out.println("太大了");
            }else {
                System.out.println("太小了");
            }
            if (i>0 && i<=5 && n==number){
                System.out.println("这么快就猜出来了，很聪明么！");
                index = i+1;
                break;
            }else if (n>number){
                System.out.println("太大了");
            }else {
                System.out.println("太小了");
            }
            if (i>5 && n==number){
                System.out.println("猜了半天才猜出来，小同志，尚需努力啊！");
                index = i+1;
                break;
            }else if (n>number){
                System.out.println("太大了");
            }else {
                System.out.println("太小了");
            }
        }
        System.out.println(index);
    }
}
